<?php
use app\common\config\send_config;
use app\common\helper\appmsg_send_helper;
?>
{include file="../app/common/admin/lib/header.html" title="群发记录管理"}
  <!-- 头部区域 -->
  <div class="page-header border-bottom clearfix">
    <h2 class="left">群发记录管理<span>在这里对群发记录进行管理</span></h2>
    <!--{/*<a href="{AnUrl('send/admin/send_queue/add')}" class="btn btn-success btn-sm right"><i class="icon-add"></i>添加群发记录</a>*/}-->
    <a href="javascript:void(0);" class="btn btn-default btn-sm right js_advancedSearchBtn">搜索</a>
  </div>
  <!-- 搜索框  -->
  <div class="search-form js_advancedForm" style="{if !$search_filter}display:none;{/if}">
    <form action="send/send_queue/index" method="get" class="js_articleSearchForm">
      <input type="hidden" name="status" value="{$status}">
      <input type="hidden" name="send_task_id" value="{$send_task_id}">
      <p style="display:none;">
        <label for="" class="search-f-label">标题：</label>
        <input type="text" class="search-f-ipt1" name="search_filter[title]" value="{$search_filter.title}">
      </p>
      <p>
      <label for="" class="search-f-label">添加时间：</label>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[start_date]" value="{$search_filter.start_date}" id="startDate">
        <span class="search-f-line"></span>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[stop_date]" value="{$search_filter.stop_date}" id="stopDate">
      </p>
      <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button></p>
    </form>
  </div>
  <div class="filter-box">按进度：
    <a href='{:url("/send/send_queue/index")}' {if $progress == 0} class="label label-primary" {else} class="label label-default" {/if}>全部</a>
    {$send_progress = send_config::$send_progress_all}
    {foreach $send_progress as $k=>$v}
    <a href='{:url("/send/send_queue/index", ["progress"=>$k+1])}' {if $progress == $k+1} class="label label-primary" {else} class="label label-default" {/if}>{$v}</a>
    {/foreach}
  </div>
  <!--start:列表-->
  <table class="list-table">
    <caption style="display:none;">按状态：
      <a href='{:url("send/admin/send_queue", ["status"=>1])}' {if $status == 1} class="label label-primary" {else} class="label label-default" {/if}>正常</a>
      <a href='{:url("send/admin/send_queue",["status"=>0])}' {if $status == 0} class="label label-primary" {else} class="label label-default" {/if}>已删除</a>
    </caption>
    <thead><tr>
      <th style="width:20px;"><input type="checkbox" class="selectAll"></th>
      <th style="width:120px;">发给范围</th>
      <th style="width:200px;">发给内容</th>
      <th style="width:150px;">群发状态</th>
      <th style="width:150px;">微信返回记录</th>
      <th style="">添加时间</th>
    </tr></thead>
    <tbody>
    {if $list['data']}
      {foreach $list['data'] as $k=>$v}
        <tr id="dataList{$v.id}" {if $k%2 == 1} class="bg-gray" {/if} style="word-break: break-all;">
          <td><input type="checkbox" class="listSelect"></td>
          <td><div style="color:#aaa;">信息id：{$v.id}{if $qian_bug == 1}<br>目标人数：{$v.user_num}{/if}</div>所有人</td>
          <td>
            {if $v.type == 1}
              <div>{$v.content}</div>
            {else}
            <div></div>
                {$pre_appmsg_list = appmsg_send_helper::get_appmsg_list($v.content)}
                {foreach $pre_appmsg_list as $k1=>$v1}
                {if $k1 == 0}<img src="{:_image($v1.cover, 'big')}" style="width:150px" />{/if}
                <div><span style="color:#b1b1b1;">[{$k1+1}]</span> {$v1.title}</div>
                {/foreach}
            {/if}
          </td>
          <td>{:send_config::$send_progress_all[$v.progress]}
          {if $v.progress == 15}<div style="color:#aaa; border-top:1px solid #aaa;">{$v.reason}</div>{/if}
          </td>
          <td>
            {if $v.progress == 20}
              <div>共发送人数：{$v.mass_total_count}</div>
              <div>微信过滤后：{$v.mass_filter_count}</div>
              <div>成功人数：{$v.mass_send_count}</div>
              <div>失败人数：{$v.mass_error_count}</div>
             {else /}
             ==
            {/if}
          </td>
          <td>{:time_format($v.add_time)}</td>
          <!--{/*-->
          <!--<td>-->
            <!--{if $status == 1}-->
              <!--<span style="display:none;" id="js_text_{$v.id}">{$smarty.const.SITE_URL}/{$module}/m/{$v.id}.html</span>-->
              <!--<a href='{:url("send/admin/send_queue/edit", ["id"=>$v.id])}' class="btn btn-info btn-xs"><i class="icon-edit icon-white"></i>编辑</a>-->
              <!--<a href='{:url("send/admin/send_queue/delete")}' class="btn btn-danger btn-xs deleteOne"><i class="icon-trash icon-white"></i>删除</a>-->
            <!--{elseif $status == 0}-->
            <!--<a href='{:url("send/send_queue/change_status", ["status"=>1])}' class="btn btn-success btn-xs changeStatus"><i class="icon-trash icon-white"></i>恢复</a>-->
            <!--{/if}-->
          <!--</td>*/}-->
        </tr>
      {/foreach}
      {else /}
          <tr><td class="txtleft" colspan="6">暂无数据</td></tr>
    {/if}
    </tbody>
    <tfoot style="display:none;">
        <tr>
            {if $status == 1}
            <td>
                <input type="checkbox" class="selectAll">
            </td>
             <td colspan="5">
                <a href='{:url("send/send_queue/delete")}' class="btn btn-danger btn-xs deleteAll">批量删除</a>&nbsp;
            </td>
            {/if}
        </tr>
    </tfoot>
  </table>
<div id="pages"></div>
<!--end:列表-->
<script>
//条件搜索
$(function(){
  // 高级搜索时间验证
  $('.js_searchBtn').click(function(e){
    e.preventDefault();
    var thisObj   = $(this);
    var startDate = $.trim($('#startDate').val());
    var stopDate  = $.trim($('#stopDate').val());
    if (startDate > stopDate) {
      showMsg('结束时间应大于等于开始时间');
      return;
    }
    thisObj.closest('form').submit();
  });
});
</script>
{include file="../app/common/admin/lib/footer.html"}